package com.xingkeduo.util.pojo.enums;

import com.xingkeduo.util.pojo.base.BaseEnum;

/**
 * 工作年限枚举
 * 
 * @author GJ
 * @time 2018年12月29日 下午4:42:18
 * @description
 */
public enum WorkYearEnum implements BaseEnum {
	LESS1(1 ,"不足1年"),
	BEWEEN1AND2(2 ,"1~2年"),
	BEWEEN2AND3(3 ,"2~3年"),	 
	BEWEEN3AND5(4 ,"3~5年"),	 
	ABOVE5(5 ,"5年以上");

	private int value;
	private String desc;

	private WorkYearEnum(int value, String desc) {
		this.value = value;
		this.desc = desc;
	}

	public static boolean validValue(String value) {
		int value_int = Integer.parseInt(value);
		return validValue(value_int);
	}

	public static boolean validValue(int value) {
		WorkYearEnum[] sources = WorkYearEnum.values();
		for (int i = 0; i < sources.length; i++) {
			if (sources[i].getValue() == value)
				return true;
		}
		return false;
	}

	public static WorkYearEnum getWorkYear(String value) {
		int value_int = Integer.parseInt(value);
		return getWorkYear(value_int);
	}

	public static WorkYearEnum getWorkYear(int value) {
		WorkYearEnum[] years = WorkYearEnum.values();
		for (int i = 0; i < years.length; i++) {
			if (years[i].getValue() == value)
				return years[i];
		}
		return null;
	}

	@Override
	public int getValue() {
		return this.value;
	}

	public String getDesc() {
		return desc;
	}
}
